package com.example.demo.bean;

import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

@EnableConfigurationProperties(UserProperties.class)
public class AutoConfig {
    @Bean
    @ConditionalOnProperty(prefix = "com.pojo",name = "enable",havingValue = "true")
    CommandLineRunner CreateUserCommandOne(){
        return new UserCommandLineRunner("one");
    }

    @Bean
    CommandLineRunner CreateUserCommandTwo(){
        return new UserCommandLineRunner("two");
    }
}
